package com.sghj.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author xrx
 * @Date 2022/10/11
 * @apiNote
 */
public class myDateUtils {

    public static String getLastMonth(int monthNum){
        SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, -monthNum);
        Date m = c.getTime();
        return sdf.format(m);
    }
}
